import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import firstLeval from '../views/firstLeval/route'
const routes = [{
        path: '/',
        name: 'Home',
        component: Home,
        children: [
            ...firstLeval
        ]
    },
    {
        path: '/about',
        name: 'About',
        component: () =>
            import ('../views/About.vue')
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})


router.afterEach((to, from) => {
    // console.log(to);
    // 通过路由后置守卫 设置title标签内的内容
    document.querySelector('title').innerText = to.meta.title
})

export default router